<form id="pagerForm" method="post" action="#rel#">
	<input type="hidden" name="pageNum" value="<?php echo $pageNum ?>" />
	<input type="hidden" name="numPerPage" value="<?php echo $limit ?>" />
	<input type="hidden" name="orderField" value="<?php echo $field ?>" />
	<input type="hidden" name="orderDirection" value="<?php echo $order_by ?>" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="<?php echo site_url('backend/order/refund'); ?>" method="post">
		<div class="searchBar">
			<ul class="searchContent">
				<li>
					<label>订单号：</label>
					<input type="text" name="o|order_num" value="<?php echo $this->input->post('o=order_num') ?>"/>
				</li>
				<li>
					<label>输入地址：</label>
					<input name="address_districtName" type="text" size="30" readonly="readonly" value="<?php echo $this->input->post('address_districtName')?>"/>
					<input type="hidden" name="o=address_id" type="text" value="<?php echo $this->input->post('address_id')?>" readonly/>
					<a class="btnLook" href="<?php echo site_url('backend/warehouse/addAgent')?>" lookupGroup="address">网点</a>
				</li>
				<li>
					<select class="combox" name="o=pay_method">
						<option value="">所有支付方式</option>
						<?php echo $this->html_helper->select(array('1'=>'支付宝', '2'=>'微信支付', '3'=>'货到付款'),$this->input->post('o=pay_method'));?>
					</select>
				</li>
				<li>
					<select class="combox" name="in_status">
						<option value="">所有状态</option>
						<?php echo $this->html_helper->select(array('2'=>'已支付','3'=>'货到付款','4'=>'待发货','5'=>'发货中','6'=>'已签收','7'=>'已完成'),$this->input->post('in_status'));?>
					</select>
				</li>
			</ul>
			<div class="subBar right">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
				</ul>
			</div>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a title="确实退款吗?" target="selectedTodo" rel="ids" postType="string" href="<?php echo site_url('backend/order/multiRefund') ?>" class="delete" callback="refundCallback"><span>批量退款</span></a></li>
			<li class="line">line</li>
			<li><a class="icon" href="javascript:;" target="dwzExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="112">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th orderField="id" class="<?php echo $order_by ?>">ID</th>
				<th>订单号</th>
				<th>支付方式</th>
				<th>退款金额</th>
				<th>退款前状态</th>
				<th>收货地址</th>
				<th>是否退款</th>
				<th>退款单号</th>
				<th>退款时间</th>
				<th>操作员</th>
			</tr>
		</thead>
		<tbody class="gridImg">
			<?php foreach ($data as $al): ?>
				<tr target="sid_user" rel="<?php echo $al['id'] ?>">
					<td><input name="ids" value="<?php echo $al['id'] ?>" type="checkbox"></td>
					<td><?php echo $al['id'] ?></td>
					<td><?php echo $al['order_num'] ?></td>
					<td><?php switch($al['pay_method']) {
						case '1': echo '支付宝';break;
						case '2': echo '微信支付';break;
						case '3': echo '货到付款';break;
						default: echo '尚未支付';break;
					} ?></td>
					<td><?php echo '￥',number_format($al['netpay'] / 100.00, 2) ?></td>
					<td><?php switch($al['in_status']) {
						case '2':
							echo '已支付';break;
						case '3':echo '货到付款';break;
						case '4':echo '待发货';break;
						case '5':echo '发货中';break;
						case '6':echo '已签收';break;
						case '7':echo '已完成';break;
						default:echo '非法状态';break;
					}?></td>
					<td><?php echo $al['contact_address'];?></td>
					<td><?php if($al['status'] === REST_Controller::STATUS_ACTIVE):?><a title="确定退款？" target="ajaxTodo" href="<?php echo site_url('backend/order/multiRefund?ids=' . $al['id']); ?>" class="btnSelect" callback="refundCallback">退款</a><?php elseif($al['status'] === REST_Controller::STATUS_PROCESSING):?>处理中<?php else:?>已退款<?php endif;?></td>
					<td><?php echo $al['refund_num'] ?></td>
					<td><?php echo date('Y-m-d H:i:s', $al['refund_time']) ?></td>
					<td><?php echo $al['master']?></td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage: this.value})">
				<?php foreach (array('20','50','100','200') as $v):?>
				<option value="<?php echo $v?>" <?php if($v==$limit):?>selected="selected"<?php endif;?>><?php echo $v?></option>
				<?php endforeach;?>
			</select>
			<span>条，共<?php echo $totalCount?>条</span>
		</div>

		<div class="pagination" targetType="navTab" totalCount="<?php echo $totalCount?>" numPerPage="<?php echo $limit?>" pageNumShown="10" currentPage="<?php echo $pageNum?>"></div>

	</div>
</div>
<script type="text/javascript">
function refundCallback(data) {
	var winObj = window.open("<?php echo site_url('backend/order/alipay')?>&form=" + data.dataCallback, '支付宝', "width=800,height=600");
	var loopInterval = setInterval(function(){
		if(winObj.closed) {
			clearInterval(loopInterval);
			navTab.reload('', {navTabId: data.navTabId});
		}
	});
}
</script>